package xyz.xmh.pattern.structural.proxypattern;


/**
 * @author Administrator
 * 实现图片接口的对象
 */
public class RealImage implements Image {

    private final String fileName;

    public RealImage(String fileName) {
        this.fileName = fileName;
        loadFromDisk(fileName);
    }


    @Override
    public void display() {
        System.out.println("Displaying:" + fileName);
    }

    /**
     * 加载来自磁盘的文件
     *
     * @param fileName 文件名
     */
    private void loadFromDisk(String fileName) {
        System.out.println("Loading:" + fileName);
    }
}
